import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_oa/route/routes.dart';

class Mine extends StatefulWidget {
  @override
  _MineState createState() => _MineState();
}

class _MineState extends State<Mine> with AutomaticKeepAliveClientMixin {
  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        elevation: 0,
        backgroundColor: Colors.green,
        title: Text(
          '我的',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        automaticallyImplyLeading: false,
      ),
      body: Container(
        color: Colors.grey[100],
        child: Container(
          margin: EdgeInsets.fromLTRB(20, 30, 20, 0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              GestureDetector(
                onTap: () {
                  String route = '${Routes.me}';
                  Routes.router.navigateTo(context, route,
                      replace: false, transition: TransitionType.fadeIn);
                },
                child: SizedBox(
                  height: 80,
                  child: Card(
                    elevation: 0,
                    color: Colors.white,
                    child: Row(
                      children: <Widget>[
                        Hero(
                          tag: 'hero',
                          child: Padding(
                            padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
                            child: Icon(
                              Icons.image,
                              size: 60,
                              color: Colors.grey,
                            ),
                          ),
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text('什么也不知道的公司',
                                style: TextStyle(
                                  fontSize: 14,
                                  color: Colors.black,
                                )),
                            Text('管理员',
                                style: TextStyle(
                                  fontSize: 12,
                                  color: Colors.black54,
                                )),
                          ],
                        ),
                      ],
                    ),
                  ),
                ),
              ),
              GestureDetector(
                onTap: () {
                  String route = '${Routes.contract}';
                  Routes.router.navigateTo(context, route,
                      replace: false, transition: TransitionType.fadeIn);
                },
                child: SizedBox(
                  height: 50,
                  child: Card(
                      elevation: 0,
                      color: Colors.white,
                      child: Padding(
                        padding: const EdgeInsets.fromLTRB(20, 0, 10, 0),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Row(
                              children: <Widget>[
                                Icon(
                                  Icons.contact_mail,
                                  color: Colors.green,
                                ),
                                SizedBox(
                                  width: 10,
                                ),
                                Text(
                                  '通讯录',
                                  style: TextStyle(
                                      color: Colors.black, fontSize: 16),
                                ),
                              ],
                            ),
                            Icon(
                              Icons.keyboard_arrow_right,
                              color: Colors.black,
                            ),
                          ],
                        ),
                      )),
                ),
              ),
              SizedBox(
                height: 50,
                child: Card(
                    elevation: 0,
                    color: Colors.white,
                    child: Padding(
                      padding: const EdgeInsets.fromLTRB(20, 0, 10, 0),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Row(
                            children: <Widget>[
                              Icon(
                                Icons.call,
                                color: Colors.blue,
                              ),
                              SizedBox(
                                width: 10,
                              ),
                              Text(
                                '联系我们',
                                style: TextStyle(
                                    color: Colors.black, fontSize: 16),
                              ),
                            ],
                          ),
                          Icon(
                            Icons.keyboard_arrow_right,
                            color: Colors.black,
                          ),
                        ],
                      ),
                    )),
              ),
              SizedBox(
                height: 50,
                child: Card(
                    elevation: 0,
                    color: Colors.white,
                    child: Padding(
                      padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Row(
                            children: <Widget>[
                              Icon(
                                Icons.contact_mail,
                                color: Colors.orangeAccent,
                              ),
                              SizedBox(
                                width: 10,
                              ),
                              Text(
                                '清除缓存',
                                style: TextStyle(
                                    color: Colors.black, fontSize: 16),
                              ),
                            ],
                          ),
                          Text(
                            '220.4KB',
                            style:
                                TextStyle(color: Colors.black54, fontSize: 14),
                          )
                        ],
                      ),
                    )),
              ),
              SizedBox(
                height: 50,
                child: Card(
                    elevation: 0,
                    color: Colors.white,
                    child: Padding(
                      padding: const EdgeInsets.fromLTRB(20, 0, 10, 0),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Row(
                            children: <Widget>[
                              Icon(
                                Icons.share,
                                color: Colors.blue,
                              ),
                              SizedBox(
                                width: 10,
                              ),
                              Text(
                                '分享',
                                style: TextStyle(
                                    color: Colors.black, fontSize: 16),
                              ),
                            ],
                          ),
                          Icon(
                            Icons.keyboard_arrow_right,
                            color: Colors.black,
                          ),
                        ],
                      ),
                    )),
              ),
              SizedBox(height: 60),
              MaterialButton(
                height: 40,
                elevation: 0,
                onPressed: () {
                  String route = '${Routes.login}';
                  Routes.router.navigateTo(context, route,
                      replace: true, transition: TransitionType.fadeIn);
                },
                child: Text(
                  "退出登录",
                  style: TextStyle(color: Colors.white, fontSize: 18),
                ),
                color: Colors.green,
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.all(Radius.circular(20))),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
